package com.dou.sample.opengl_project.render;

import android.content.Context;
import android.opengl.GLSurfaceView;

import com.dou.sample.opengl_project.shader.ColorShaderProgram;
import com.dou.sample.opengl_project.shader.TextureShaderProgram;
import com.dou.sample.opengl_project.shape.Triangel;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/**
 * Created by Dou on 2018/1/19.
 */

public class TriangelRenderer implements GLSurfaceView.Renderer {

    Triangel triangel;
    Context context;

    ColorShaderProgram colorShaderProgram;
    TextureShaderProgram textureShaderProgram;

    public TriangelRenderer(Context context){
        this.context = context;

        triangel = new Triangel();
    }

    @Override
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        gl.glClearColor(0, 0, 0, 0);

        colorShaderProgram = new ColorShaderProgram(context);
    }

    @Override
    public void onSurfaceChanged(GL10 gl, int width, int height) {
        gl.glViewport(0, 0, width, height);
    }

    @Override
    public void onDrawFrame(GL10 gl) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    }
}
